<template>
    <div class="mark_frame">
        <el-skeleton animated :loading="loading" :rows="9" />
  <mavon-editor 
  style="height:100%;width:100%"
  :value = "mdValue"
  :html="false"
  @save="saveMarkdown"
  ></mavon-editor>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
name:'YMarkdownEditor',
data(){
    return {
        loading:true,
        mdValue:''
    }
},
mounted(){
    if(this.process.meta&&this.process.meta.file){
         // 进行文件的加载
         this.$basicAxios(this.$ms.getFileContent(this.process.meta.file.fileId,this.token,"UTF8"),(resp)=>{
            this.mdValue = resp.data.data
            this.loading = false
         })
    }else{
        this.loading = false
    }
},
props:{
    process:{
        type:Object,
        required:true
    }
},
computed:{
...mapState('userAbout',['user','token'])
},
methods:{
    saveMarkdown(value,render){
        this.$basicAxios(this.$ms.pushFileContent(this.process.meta.file.fileId,value,this.token,'UTF8'))
    }
}
}
</script>

<style>
.mark_frame{
    width:100%;
    height:100%
}
</style>